import React from 'react';
import { Collapse as AntdCollapse } from 'antd';
import type { CollapseProps as AntdCollapseProps } from 'antd';
import { createStyles } from 'antd-style';

export interface CollapseProps extends AntdCollapseProps {
  /**
   * @description 自定义样式类名
   */
  customClassName?: string;
}

const useStyles = createStyles(({ token, css }) => ({
  collapse: css`
    border-radius: ${token.borderRadius}px;
  `,
}));

const Collapse: React.FC<CollapseProps> = ({ customClassName, className, ...restProps }) => {
  const { styles, cx } = useStyles();
  
  const collapseClassName = cx(
    className,
    customClassName,
    styles.collapse
  );

  return <AntdCollapse className={collapseClassName} {...restProps} />;
};

export { Collapse };
export default Collapse;

